<%@page import="org.eclipse.football.League"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css" href="Style.css" />
<title>Player Page</title>
</head>
<body>

<%-- Display username and log out button--%>
<% // make sure username is initialized
String username = (String)request.getSession(true).getAttribute("username");

if(username==null){
	request.getSession().setAttribute("username", "");
	getServletContext().getRequestDispatcher("/PlayerPage.jsp").forward(request, response);
}%>


<FORM action="/FootballStats/log_in" method="post">

<c:if test="${off != null}">
<H1><c:out value="${off.getName()}" /></H1>
</c:if>
<c:if test="${def != null}">
<H1><c:out value="${def.getName()}" /></H1>
</c:if>
<c:if test="${kicker != null}">
<H1><c:out value="${kicker.getName()}" /></H1>
</c:if>

<P> Not <c:out value="${username}" />? 
<INPUT type="submit" name="button" value="Change Account">
<INPUT type="button" value="To League Page" onClick="location.href='LeagueSummary.jsp'">
<INPUT type="button" value="To Team Page" onClick="location.href='TeamPage.jsp'">
</FORM>
<BR>
<BR>

<c:if test="${off != null}">
<!-- Off Table Start -->
<!-- Off Table Header Start -->
<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">
Offensive Player
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="9"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="Pass YDs" value="Pass YDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="Pass TDs" value="Pass TDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="INTs" value="INTs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Rush YDs" value="Rush YDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="Rush TDs" value="Rush TDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Rec. YDs" value="Rec. YDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="6"></input>
<input type="submit" name="Rec. TDs" value="Rec. TDs"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="7"></input>
<input type="submit" name="Fumbles" value="Fumbles"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_off" method="post">
<input type="hidden" name="type" value="8"></input>
<input type="submit" name="Return TDs" value="Return TDs"></input>
</form>
</th>
</tr>
<!-- Off Table Header End -->

<!-- Off Table Row Start -->
<tr>
<td>
<%--<form action="/FootballStats/pick_off" method="post">
 <input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>--%>
<c:out value="${off.getName() }"/>
</td>
<td>
<c:out value="${off.calculatePoints() }"/>
</td>
<td>
<c:out value="${off.getPass_yds() }"/>
</td>
<td>
<c:out value="${off.getPass_tds() }"/>
</td>
<td>
<c:out value="${off.getPicks() }"/>
</td>
<td>
<c:out value="${off.getRush_yds() }"/>
</td>
<td>
<c:out value="${off.getRush_tds() }"/>
</td>
<td>
<c:out value="${off.getRec_yds() }"/>
</td>
<td>
<c:out value="${off.getRec_tds() }"/>
</td>
<td>
<c:out value="${off.getFumbles() }"/>
</td>
<td>
<c:out value="${off.getRet_tds() }"/>
</td>
</tr>
</table>
<!-- Off Table Row End -->
<!-- Off Table End -->
</c:if>


<c:if test="${def != null}">
<!-- Def Table Start -->
<!-- Def Table Header Start -->
<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Defense/Special Teams</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="8"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="Defensive Touchdowns" value="Defensive Touchdowns"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="Defensive Interceptions" value="Defensive Interceptions"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="Fumbles Recovered" value="Fumbles Recovered"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Sacks" value="Sacks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="4"></input>
<input type="submit" name="Blocked Kicks" value="Blocked Kicks"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="5"></input>
<input type="submit" name="Safeties" value="Safeties"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="6"></input>
<input type="submit" name="Points Allowed" value="Points Allowed"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_def" method="post">
<input type="hidden" name="type" value="7"></input>
<input type="submit" name="Yards Allowed" value="Yards Allowed"></input>
</form>
</th>
</tr>
<!-- Def Table Header End -->

<!-- Def Table Row Start -->
<tr>
<td>
<%-- <form action="/FootballStats/pick_def" method="post">
<input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>--%>
<c:out value="${def.getName() }"/>
</td>
<td>
<c:out value="${def.calculatePoints() }"/>
</td>
<td>
<c:out value="${def.getDef_tds() }"/>
</td>
<td>
<c:out value="${def.getPicks() }"/>
</td>
<td>
<c:out value="${def.getFumbles() }"/>
</td>
<td>
<c:out value="${def.getSacks() }"/>
</td>
<td>
<c:out value="${def.getBlocks() }"/>
</td>
<td>
<c:out value="${def.getSafeties() }"/>
</td>
<td>
<c:out value="${def.getPa() }"/>
</td>
<td>
<c:out value="${def.getYa() }"/>
</td>
</tr>
</table>
<!-- Def Table Row End -->
<!-- Def Table End -->
</c:if>

<c:if test="${kicker != null}">
<!-- Def Table Start -->
<!-- Def Table Header Start -->
<table border="1" cellspacing="0">
<tr>
<th align="center" valign="middle" width="100">Kicker</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="3"></input>
<input type="submit" name="Points" value="Points"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="0"></input>
<input type="submit" name="PAT Made" value="PAT Made"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="1"></input>
<input type="submit" name="FG Made" value="FG Made"></input>
</form>
</th>
<th align="center" valign="middle">
<form action="/FootballStats/sort_kicker" method="post">
<input type="hidden" name="type" value="2"></input>
<input type="submit" name="FG Missed" value="FG Missed"></input>
</form>
</th>
</tr>
<!-- Kicker Table Header End -->

<!-- Kicker Table Row Start -->
<tr>
<td>
<%--<form action="/FootballStats/pick_kicker" method="post">
<input type="hidden" name="name" value="${player.getName() }"></input>
<input type="submit" name="PickPlayer" value="${player.getName() }"></input>
</form>--%>
<c:out value="${kicker.getName() }"/>
</td>
<td>
<c:out value="${kicker.calculatePoints() }"/>
</td>
<td>
<c:out value="${kicker.getPat() }"/>
</td>
<td>
<c:out value="${kicker.getFg() }"/>
</td>
<td>
<c:out value="${kicker.getMisses() }"/>
</td>
</tr>
</table>
</c:if>
<!-- Kicker Table Row End -->
<!-- Kicker Table End -->

</body>
</html>